package com.jams.goodox.net.services;

import com.google.gson.JsonObject;
import com.jams.goodox.activity.home.AlbumBean;
import com.jams.goodox.activity.home.CityResp;
import com.jams.goodox.activity.home.ColtResp;
import com.jams.goodox.activity.home.GoodsBean;
import com.jams.goodox.activity.home.NewsResp;
import com.jams.goodox.activity.home.ProductBean;
import com.jams.goodox.activity.mine.HuiyuanBean;
import com.jams.goodox.constant.UrlConstants;
import com.jams.goodox.entity.MyServiceAddress;
import com.jams.goodox.entity.resp.AllServerListResp;
import com.jams.goodox.entity.resp.EmsBeanResp;
import com.jams.goodox.entity.resp.HomeResp;
import com.jams.goodox.entity.resp.ServerResp;
import com.jams.goodox.entity.resp.SimpleResp;
import com.jams.goodox.entity.resp.UnitRoomResp;
import com.jams.goodox.net.BaseEntity;

import java.util.List;
import java.util.Map;

import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;

/**
 * Created by jams on 2016/9/19.
 * ***
 * Tel: ***
 */

public interface HomeService {

    //根据注册邀请码获取园区相关信息
    @GET(UrlConstants.getCommunityInfoByNo)
    Call<UnitRoomResp> getCommunityInfoByNo(@Query("registNo") String registNo);

    //获取单个服务信息
    @GET(UrlConstants.getServerBean)
    Call<ServerResp> getServerInfo(@Query("subId") String subId, @Query("communityId") String communityId);

    //开道闸
    @GET(UrlConstants.OWNER_PASSAGE)
    Call<SimpleResp> ownerPassage(@Query("param") String param);

    //物流编号查询公司列表
    @GET(UrlConstants.queryEmsCompany)
    Call<EmsBeanResp> queryEmsByNo(@Query("number") String number);

    //获取个人首页数据
    @GET(UrlConstants.Home)
    Call<HomeResp> getHomeData(@Query("token") String token);

    //获取个人首页数据
    @GET(UrlConstants.News)
    Call<NewsResp> getNews(@Query("token") String token);

    //获取个人首页数据
    @GET(UrlConstants.Album)
    Call<AlbumBean> getAlbum(@Query("token") String token);

    @GET(UrlConstants.Product)
    Call<ProductBean> getProduct(@Query("token") String token,@Query("type") String type,@Query("sort") String sort);

    @GET(UrlConstants.ProductDetail)
    Call<GoodsBean> getProductDetail(@Query("token") String token, @Query("id") String id, @Query("detail") String detail);

    @GET(UrlConstants.collect)
    Call<BaseEntity> collect(@Query("token") String token, @Query("id") String id);

    @GET(UrlConstants.joinShopCart)
    Call<BaseEntity> joinShopCart(@QueryMap Map<String, String> names);
    //获取全部服务
    @GET(UrlConstants.getAllServer)
    Call<AllServerListResp> getAllServer(@Path("communityId") String communityId);

    @GET(UrlConstants.myShopCart)
    Call<JsonObject> myShopCart(@Query("token") String token);

    @GET(UrlConstants.ShopCartEdit)
    Call<BaseEntity> ShopCartEdit(@Query("token") String token,@Query("id") String id,@Query("num") String num,@Query("delete") int isDelete);

    @GET(UrlConstants.addressList)
    Call<MyServiceAddress> addressList(@Query("token") String token);

    @GET(UrlConstants.myOrder)
    Call<JsonObject> myOrder(@Query("token") String token,@Query("type") String type);

    @FormUrlEncoded
    @POST(UrlConstants.orderActive)
    Call<BaseEntity> orderActive(@Field("token") String token,@Field("type") String type,@Field("ordersn") String ordersn,@FieldMap Map<String,String> maps);

    @Multipart
    @POST(UrlConstants.orderActive)
    Call<BaseEntity> orderActive(@Part("token") RequestBody token, @Part("type") RequestBody type, @Part("ordersn") RequestBody ordersn, @PartMap Map<String, RequestBody> maps, @Part List<MultipartBody.Part> partList);

    @GET(UrlConstants.daybook)
    Call<HuiyuanBean> daybook(@Query("token") String token);

    @GET(UrlConstants.collectList)
    Call<ColtResp> collectList(@Query("token") String token);

    @GET(UrlConstants.history)
    Call<ColtResp> history(@Query("token") String token);

    //获取城市列表
    @GET(UrlConstants.city)
    Call<CityResp> city(@Query("key") String key);

    //获取城市列表
    @GET(UrlConstants.city)
    Call<CityResp> shi(@Query("key") String key,@Query("id") String id);

    //保存地址
    @GET(UrlConstants.addressEdit)
    Call<BaseEntity> addressEdit(@QueryMap Map<String,String> params);

    @FormUrlEncoded
    @POST(UrlConstants.orderSubmit)
    Call<BaseEntity> orderSubmit(@Field("token") String token,@Field("order") String order);
}
